<template>
  <div class="goods">
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span style="line-height: 36px;">采购订单管理</span>
        <el-button style="float: right;" type="primary" @click="dialogOpen('add')" v-if="USER.auth.indexOf('inOperation_purchas_add')!==-1">新增采购订单</el-button>
      </div>
      <s-table
        :table="table"
        @http="tableWatch">
        <el-form-item label="编号" prop="bh">
          <el-input type="text"
                    class="input"
                    v-model="autoVue_table_bh"
                    placeholder="编号" spellcheck="false" auto-capitalize="off" auto-complete="off"
                    auto-correct="off"></el-input>
        </el-form-item>
        <el-form-item label="创建时间" prop="cjsj">
          <el-date-picker
            v-model="autoVue_table_cjsj"
            type="daterange"
            align="right"
            placeholder="选择日期范围">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="供商名称" prop="gysmc">
          <el-input type="text"
                    class="input"
                    v-model="autoVue_table_gysmc"
                    placeholder="供应商名称" spellcheck="false" auto-capitalize="off" auto-complete="off"
                    auto-correct="off"></el-input>
        </el-form-item>
        <el-form-item label="PO状态" prop="zt">
          <el-select v-model="autoVue_table_zt"
                     placeholder="PO状态">
            <el-option
              label="全部"
              value=""></el-option>
            <el-option
              v-for="item in PURCHASE.zt"
              :key="item.dictionaryid"
              :label="item.value"
              :value="item.dictionaryid">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="审核状态" prop="shzt">
          <el-select v-model="autoVue_table_shzt"
                     placeholder="是否审核">
            <el-option
              label="全部"
              value=""></el-option>
            <el-option
              label="未审核"
              value="0"></el-option>
            <el-option
              label="已审核"
              value="1"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item slot="multiSelect" label="多选操作" prop="multiSelect" v-if="table.multiSelect">
          <el-row>
            <el-col :span="8">
              <el-button size="small" type="info" @click="tableExport('')" v-if="USER.auth.indexOf('inOperation_purchas_export')!==-1">多选导出</el-button>
            </el-col>
            <el-col :span="8">
              <el-button size="small" type="success" @click="tableComplete('')" v-if="USER.auth.indexOf('inOperation_purchas_sign')!==-1">收货完成</el-button>
            </el-col>
            <el-col :span="8">
              <el-button size="small" type="warning" @click="tableExamine('')" v-if="USER.auth.indexOf('inOperation_purchas_examine')!==-1">多选审核</el-button>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-button size="small" type="danger" @click="tableDelete('')">多选删除</el-button>
            </el-col>
          </el-row>
        </el-form-item>
        <el-table-column
          fixed="right"
          align="center"
          slot="operation"
          class-name="operationMore"
          label="可用操作"
          width="125">
          <template scope="s">
            <el-button type="info" size="mini" @click="dialogSearchOpen(s.row)" v-if="USER.auth.indexOf('inOperation_purchas_search')!==-1" icon="search"></el-button>
            <el-button type="warning" v-if="USER.auth.indexOf('inOperation_purchas_examine')!==-1 && s.row.shzt == '0'" size="mini" @click="tableExamine(s.row)">审核</el-button>
            <el-button type="success" size="mini" @click="tableComplete(s.row)" v-if="USER.auth.indexOf('inOperation_purchas_sign')!==-1 && s.row.zt == '1'">收货完成</el-button>
            <el-tooltip placement="top" v-if="s.row.shzt == '0'">
              <div slot="content">更多可用操作</div>
              <el-popover
                popper-class="demo-table-expand"
                placement="right"
                title="更多可用操作"
                trigger="click">
                <slot name="content">
                  <el-button type="success" icon="edit" size="mini"  @click="dialogEditOpen(s.row)">修改</el-button>
                  <el-button type="info" :plain="true"  size="mini" @click="tableExport(s.row)" v-if="USER.auth.indexOf('inOperation_purchas_export')!==-1"><i class="fa fa-file-excel-o" aria-hidden="true"></i> 导出</el-button>
                  <el-button type="danger" icon="delete" size="mini" @click="tableDelete(s.row)" v-if="USER.auth.indexOf('inOperation_purchas_delete')!==-1">删除</el-button>
                </slot>
                <el-button slot="reference" type="info" icon="more" :plain="true" size="mini" class="__reference"></el-button>
              </el-popover>
            </el-tooltip>
            <el-button type="info" :plain="true" v-if="USER.auth.indexOf('inOperation_purchas_export')!==-1 && s.row.shzt != '0'" size="mini" @click="tableExport(s.row)"><i class="fa fa-file-excel-o" aria-hidden="true"></i></el-button>
          </template>
        </el-table-column>
      </s-table>
    </el-card>
    <s-dialog :dialog="dialog" :close="dialogInit">
      <p slot="title">新增采购订单</p>
      <el-tabs v-model="dialog.activeName">
        <el-tab-pane label="供应商" name="1" disabled>
          <s-form :form="formDialog1" ref="formDialog1">
            <el-row>
              <el-col :xs="24" :lg="{span: 7, offset: 0}" class="">
                <el-form-item prop="bh" label="供应商编号">
                  <el-select v-model="formDialog1.gysid"
                             filterable
                             remote
                             placeholder="请选择供应商"
                             @change="dialogSupplierGysid">
                    <el-option
                      v-for="item in dialog.id"
                      :key="item.id"
                      :label="item.bh + '    ' + item.mc"
                      :value="item.id">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :lg="{span: 7, offset: 1}" class="" v-show="formDialog1.gysid!==''">
                <el-form-item prop="mc" label="供应商名称">
                  <div class="s-content">{{dialog.gys.mc}}</div>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :lg="{span: 7, offset: 1}" class="" v-show="formDialog1.gysid!==''">
                <el-form-item prop="lxr" label="联系人">
                  <div class="s-content">{{dialog.gys.lxr}}</div>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row v-show="formDialog1.gysid!==''">
              <el-col :xs="24" :lg="{span: 7, offset: 0}" class="">
                <el-form-item prop="dh1" label="电话1">
                  <div class="s-content">{{dialog.gys.dh1}}</div>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :lg="{span: 7, offset: 1}" class="">
                <el-form-item prop="dh2" label="电话2">
                  <div class="s-content">{{dialog.gys.dh2}}</div>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :lg="{span: 7, offset: 1}" class="">
                <el-form-item prop="cz" label="传真">
                  <div class="s-content">{{dialog.gys.cz}}</div>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row v-show="formDialog1.gysid!==''">
              <el-col :xs="24" :lg="{span: 7, offset: 0}" class="">
                <el-form-item prop="gj" label="国家">
                  <div class="s-content">{{dialog.gys.gj}}</div>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :lg="{span: 7, offset: 1}" class="">
                <el-form-item prop="cs" label="城市">
                  <div class="s-content">{{dialog.gys.cs}}</div>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :lg="{span: 7, offset: 1}" class="">
                <el-form-item prop="sheng" label="省">
                  <div class="s-content">{{dialog.gys.sheng}}</div>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row v-show="formDialog1.gysid!==''">
              <el-col :xs="24" :lg="{span: 7, offset: 0}" class="">
                <el-form-item prop="yb" label="邮编">
                  <div class="s-content">{{dialog.gys.yb}}</div>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :lg="{span: 7, offset: 1}" class="">
                <el-form-item prop="xxdz" label="详细地址">
                  <div class="s-content">{{dialog.gys.xxdz}}</div>
                </el-form-item>
              </el-col>
            </el-row>
          </s-form>
        </el-tab-pane>
        <el-tab-pane label="采购订单信息" name="2" disabled>
          <s-form :form="formDialog2" ref="formDialog2">
            <el-row>
              <el-col :xs="24" :lg="{span: 7, offset: 0}" class="">
                <el-form-item prop="bh" label="PO编号">
                  <el-input
                    type="text"
                    placeholder="备注"
                    v-model="formDialog2.bh"></el-input>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :lg="{span: 7, offset: 1}" class="">
                <el-form-item label="仓库名称">
                  <div class="s-content">
                    <el-tag type="success">{{USER.user.orgName}}</el-tag>
                  </div>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :lg="{span: 7, offset: 1}" class="">
                <el-form-item prop="lx" label="PO类型">
                  <el-select v-model="formDialog2.lx"
                             filterable
                             remote
                             placeholder="请选择PO类型"
                             @change="dialogRemotePozt"
                             :remote-method="dialogRemotePOlx">
                    <el-option
                      v-for="item in dialog.wmsPurchaseOrder"
                      :key="item.id"
                      :label="item.ddlx"
                      :value="item.id">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :xs="24" :lg="{span: 7, offset: 0}" class="">
                <el-form-item prop="yjdhsj" label="预计到货时间">
                  <el-date-picker
                    v-model="formDialog2.yjdhsj"
                    type="datetime"
                    placeholder="选择日期范围">
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :lg="{span: 7, offset: 1}" class="">
                <el-form-item prop="bz" label="备注">
                  <el-input
                    type="text"
                    placeholder="备注"
                    v-model="formDialog2.bz"></el-input>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :lg="{span: 7, offset: 1}" class="">
                <el-form-item prop="shzt" label="审核状态" v-show="formDialog2.shzt!==''">
                  <div class="s-content">
                    <el-tag type="info">{{formDialog2.shzt}}</el-tag>
                  </div>
                </el-form-item>
              </el-col>
            </el-row>
          </s-form>
        </el-tab-pane>
        <el-tab-pane label="采购订单明细" name="3" disabled>
          <div class="__table">
            <el-button @click="dialogMxOpen('add')" class="__table_button"><i class="el-icon-plus"></i></el-button>
            <s-table :table="tableMx" :pagination="false" :control="false" ref='tableMx'>
              <el-table-column
                fixed="right"
                align="center"
                slot="operation"
                class-name="operationMore"
                label="操作"
                width="80">
                <template scope="s">
                  <el-button type="success" icon="edit" size="mini" @click="dialogMxOpen('put', s.row)"></el-button>
                  <el-button type="danger" icon="delete" size="mini" @click="tableMxDelete(s.$index)"></el-button>
                </template>
              </el-table-column>
            </s-table>
          </div>
        </el-tab-pane>
      </el-tabs>
      <el-button slot="footer" v-if="dialog.activeName !== '1'" @click="dialogPre">上一页</el-button>
      <el-button slot="footer" type="info" v-if="dialog.activeName !== '3'" @click="dialogNext">下一页</el-button>
      <el-button slot="footer" type="success" v-if="dialog.activeName === '3'" @click="dialogSave">保存</el-button>
    </s-dialog>
    <s-dialog :dialog="dialogEdit" :close="dialogEditInit">
      <p slot="title">编辑采购订单头信息</p>
      <s-form :form="formDialogEdit" ref="formDialogEdit">
        <el-row>
          <el-col :xs="24" :lg="{span: 7, offset: 0}" class="">
            <el-form-item prop="bh" label="PO编号">
              <el-input
                type="text"
                placeholder="PO编号"
                v-model="formDialogEdit.bh"></el-input>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :lg="{span: 7, offset: 1}" class="">
            <el-form-item label="仓库名称">
              <div class="s-content">
                <el-tag type="success">{{USER.user.orgName}}</el-tag>
              </div>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :lg="{span: 7, offset: 1}" class="">
            <el-form-item prop="lx" label="PO类型">
              <el-select v-model="formDialogEdit.lx"
                         filterable
                         remote
                         placeholder="请选择PO类型"
                         @change="dialogRemotePozt"
                         :remote-method="dialogRemotePOlx">
                <el-option
                  v-for="item in dialog.wmsPurchaseOrder"
                  :key="item.id"
                  :label="item.ddlx"
                  :value="item.id">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :xs="24" :lg="{span: 7, offset: 0}" class="">
            <el-form-item prop="yjdhsj" label="预计到货时间">
              <el-date-picker
                v-model="formDialogEdit.yjdhsj"
                type="datetime"
                placeholder="选择日期范围">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :lg="{span: 7, offset: 1}" class="">
            <el-form-item prop="bz" label="备注">
              <el-input
                type="text"
                placeholder="备注"
                v-model="formDialogEdit.bz"></el-input>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :lg="{span: 7, offset: 1}" class="">
            <el-form-item prop="shzt" label="审核状态" v-show="formDialogEdit.shzt!==''">
              <div class="s-content">
                <el-tag type="info">{{formDialogEdit.shzt}}</el-tag>
              </div>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :xs="24" :lg="{span: 7, offset: 0}" class="">
            <el-form-item prop="bh" label="供应商编号">
              <el-select v-model="formDialogEdit.gysid"
                         filterable
                         remote
                         placeholder="请选择供应商"
                         @change="dialogSupplierGysid">
                <el-option
                  v-for="item in dialog.id"
                  :key="item.id"
                  :label="item.bh"
                  :value="item.id">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-collapse>
          <el-collapse-item title="供应商详情" name="1">
            <el-row>
              <el-col :xs="24" :lg="{span: 7, offset: 0}" class="">
                <el-form-item prop="dh1" label="供应商编号">
                  <div class="s-content">{{dialog.gys.bh}}</div>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :lg="{span: 7, offset: 1}">
                <el-form-item prop="mc" label="供应商名称">
                  <div class="s-content">{{dialog.gys.mc}}</div>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :lg="{span: 7, offset: 1}">
                <el-form-item prop="lxr" label="联系人">
                  <div class="s-content">{{dialog.gys.lxr}}</div>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :xs="24" :lg="{span: 7, offset: 0}" class="">
                <el-form-item prop="dh1" label="电话1">
                  <div class="s-content">{{dialog.gys.dh1}}</div>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :lg="{span: 7, offset: 1}" class="">
                <el-form-item prop="dh2" label="电话2">
                  <div class="s-content">{{dialog.gys.dh2}}</div>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :lg="{span: 7, offset: 1}" class="">
                <el-form-item prop="cz" label="传真">
                  <div class="s-content">{{dialog.gys.cz}}</div>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :xs="24" :lg="{span: 7, offset: 0}" class="">
                <el-form-item prop="gj" label="国家">
                  <div class="s-content">{{dialog.gys.gj}}</div>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :lg="{span: 7, offset: 1}" class="">
                <el-form-item prop="cs" label="城市">
                  <div class="s-content">{{dialog.gys.cs}}</div>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :lg="{span: 7, offset: 1}" class="">
                <el-form-item prop="sheng" label="省">
                  <div class="s-content">{{dialog.gys.sheng}}</div>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :xs="24" :lg="{span: 7, offset: 0}" class="">
                <el-form-item prop="yb" label="邮编">
                  <div class="s-content">{{dialog.gys.yb}}</div>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :lg="{span: 7, offset: 1}" class="">
                <el-form-item prop="xxdz" label="详细地址">
                  <div class="s-content">{{dialog.gys.xxdz}}</div>
                </el-form-item>
              </el-col>
            </el-row>
          </el-collapse-item>
        </el-collapse>
      </s-form>
      <el-button slot="footer" type="success" @click="dialogEditSave">保存</el-button>
    </s-dialog>
    <s-dialog :dialog="dialogMx" :close="dialogMxInit">
      <p slot="title">{{dialogMx.title}}</p>
      <s-form :form="formDialogMx" ref="formDialogMx">
        <el-row>
          <el-col :xs="24" :lg="{span: 5, offset: 0}" class="">
            <el-form-item prop="bh" label="货品编号">
              <el-select v-model="formDialogMx.bh"
                         filterable
                         remote
                         @change="dialogMxChangeBh"
                         :remote-method="dialogMxRemoteBh"
                         placeholder="请选择货品编号">
                <el-option
                  v-for="item in dialogMx.hpid"
                  :key="item.goodsId"
                  :label="item.goodsBh"
                  :value="item.goodsBh">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :lg="{span: 5, offset: 1}" class="">
            <el-form-item prop="mc" label="货品名称">
              <el-input
                type="text"
                disabled
                v-model="formDialogMx.mc"
                placeholder="货品名称"></el-input>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :lg="{span: 5, offset: 1}" class="">
            <el-form-item prop="bzmc" label="包装名称">
              <el-input
                type="text"
                disabled
                v-model="formDialogMx.bzmc"
                placeholder="包装名称"></el-input>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :lg="{span: 5, offset: 1}" class="">
            <el-form-item prop="ms" label="主单位">
              <el-select v-model="formDialogMx.ms"
                         @change="dialogMxChangeMs"
                         placeholder="请选择主单位">
                <el-option
                  v-for="item in dialogMx.pack"
                  :key="item.id"
                  :label="item.ms"
                  :value="item.ms">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :xs="24" :lg="{span: 5, offset: 0}" class="">
            <el-form-item prop="tj" label="体积">
              <el-input
                type="text"
                disabled
                v-model="formDialogMxtj"
                placeholder="体积"></el-input>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :lg="{span: 5, offset: 1}" class="">
            <el-form-item prop="jz" label="净重">
              <el-input
                type="text"
                disabled
                v-model="formDialogMxjz"
                placeholder="净重"></el-input>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :lg="{span: 5, offset: 1}" class="">
            <el-form-item prop="zl" label="毛重">
              <el-input
                type="text"
                disabled
                v-model="formDialogMxzl"
                placeholder="毛重"></el-input>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :lg="{span: 5, offset: 1}" class="">
            <el-form-item prop="je" label="金额">
              <el-input
                type="text"
                disabled
                v-model="formDialogMxje"
                placeholder="金额"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :xs="24" :lg="{span: 5, offset: 0}" class="">
            <el-form-item prop="sl" label="主单位">
              <el-input
                type="text"
                :disabled="formDialogMx.ms && dialogMx.packValue.bzlx !== '0'"
                v-model="formDialogMx.sl"
                placeholder="主单位数量"></el-input>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :lg="{span: 5, offset: 1}" class="">
            <el-form-item prop="xdwsl" label="箱单位">
              <el-input
                type="text"
                :disabled="formDialogMx.ms && dialogMx.packValue.bzlx === '0'"
                v-model="formDialogMx.xdwsl"
                placeholder="箱单位数量"></el-input>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :lg="{span: 5, offset: 1}" class="">
            <el-form-item prop="je" label="总金额">
              <el-input
                type="text"
                v-model="formDialogMx.sum"
                placeholder="总金额"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-form-item prop="bz" label="备注">
            <el-input
              type="textarea"
              :rows="2"
              v-model="formDialogMx.bz"
              placeholder="备注"></el-input>
          </el-form-item>
        </el-row>
      </s-form>
      <el-button slot="footer" @click="dialogMxSave">保存</el-button>
    </s-dialog>
    <s-dialog :dialog="dialogSearch" :close="dialogSearchInit" :closeTip="false">
      <p slot="title">查看明细<span>{{dialogSearch.row.bh}}</span></p>
      <div class="__table">
        <el-button @click="dialogMxOpen('add')"
                   v-if="dialogSearch.row.shzt == '0'"
                   class="__table_button"><i class="el-icon-plus"></i></el-button>
        <s-table :table="tableSearch" ref='tableSearch' :pagination="false" :control="dialogSearch.row.shzt != '0'">
          <el-table-column
            v-if="dialogSearch.row.shzt == '0'"
            fixed="right"
            align="center"
            slot="operation"
            class-name="operationMore"
            label="操作"
            width="80">
            <template scope="s">
              <el-button type="success" icon="edit" size="mini" @click="dialogMxOpen('put', s.row)"></el-button>
              <el-button type="danger" icon="delete" size="mini" @click="tableSearchDelete(s.row)"></el-button>
            </template>
          </el-table-column>
        </s-table>
      </div>
      <el-button slot="footer" type="warning" v-if="dialogSearch.row.shzt == '0'" @click="tableExamine(dialogSearch.row)">通过审核</el-button>
      <el-button slot="footer" @click="dialogSearchSave">好</el-button>
    </s-dialog>
  </div>
</template>

<script>
  import {AutoVue, AutoPromise} from '~/plugins/Tools';
  function __form1 () {
    return {
      gysid: { value: '', rule: [ 'vNull__change' ], cRemarks: '供应商编号' },
    };
  }
  function __dialogGys () {
    return {
      bh: '',
      mc: '',
      lxr: '',
      xxdz: '',
      dh1: '',
      dh2: '',
      cz: '',
      cs: '',
      sheng: '',
      gj: '',
      yb: '',
    };
  }
  function __form2 () {
    return {
      bh: { value: '', rule: [ 'vNull' ], cRemarks: '' },
      lx: { value: '', rule: [ 'vNull' ], cRemarks: '' },
      cjsj: { value: '', rule: [ '' ], cRemarks: '' },
      erpcjsj: { value: '', rule: [ '' ], cRemarks: '' },
      shzt: { value: '', rule: [], cRemarks: '' },
      zdsh: { value: '', rule: [], cRemarks: '' },
      yjdhsj: { value: '', rule: [ 'vNull__change' ], type: 'Date', cRemarks: '' },
    };
  }
  function __formDialogMx_goods () { // hpid
    return {
      mc: { value: '', rule: [], cRemarks: '' },
      bzmc: { value: '', rule: [], cRemarks: '' },
    };
  }
  function __formDialogMx_pack () {
    return {
      tj: { value: '', rule: [], cRemarks: '' },
      jz: { value: '', rule: [], cRemarks: '' },
      zl: { value: '', rule: [], cRemarks: '' },
      je: { value: '', rule: [], cRemarks: '' },
      zdwsl: { value: '', rule: [], cRemarks: '' },
    };
  }
  function __formDialogMx () {
    return {
      bh: { value: '', rule: ['vNull__change'], cRemarks: '' },
      ...__formDialogMx_goods(),
      ms: { value: '', rule: ['vNull__change'], cRemarks: '' },
      ...__formDialogMx_pack(),
      sl: { value: '', rule: ['vNumber', 'vZNumber', 'vZZNumber'], cRemarks: '' },
      sum: { value: 0, rule: ['vNumber', 'vZNumber', 'vZZNumber'], cRemarks: '' },
      xdwsl: { value: '', rule: ['v_XiangYanZhen'], cRemarks: '' },
    };
  }
  function __formEdit () {
    return {
      ...__form1(),
      ...__form2(),
    };
  }
  function __tableMx () {
    return {
      column: [
        { label: '货品编号',
          prop: 'bh',
          minWidth: '0px',
          cRemarks: '',
          search: false },
        { label: '货品名称',
          prop: 'mc',
          minWidth: '0px',
          cRemarks: '',
          search: false },
        { label: '包装名称',
          prop: 'bzmc',
          minWidth: '0px',
          cRemarks: '',
          search: false },
        { label: '主单位',
          prop: 'ms',
          minWidth: '0px',
          cRemarks: '',
          search: false },
        { label: '主单位数量',
          prop: 'sl',
          minWidth: '0px',
          cRemarks: '',
          search: false },
        { label: '箱单位数量',
          prop: 'xdwsl',
          minWidth: '0px',
          cRemarks: '',
          search: false },
        { label: '体积',
          prop: 'tj',
          disabled: true,
          minWidth: '0px',
          cRemarks: '',
          search: false },
        { label: '净重',
          prop: 'jz',
          disabled: true,
          minWidth: '0px',
          cRemarks: '',
          search: false },
        { label: '毛重',
          prop: 'zl',
          disabled: true,
          minWidth: '0px',
          cRemarks: '',
          search: false },
        { label: '金额',
          prop: 'je',
          minWidth: '0px',
          cRemarks: '',
          search: false },
        { label: '备注',
          prop: 'bz',
          minWidth: '0px',
          cRemarks: '',
          search: false },
      ],
      key: 'bh',
      tableColumn: 4,
    };
  }
  export default AutoVue({
    name: 'inOperation_purchase-FEcarWms',
    data: {
      table: {
        column: [
          { label: '供应商名称',
            prop: 'gysmc',
            minWidth: '0px',
            cRemarks: '',
            search: true },
          { label: '编号',
            prop: 'bh',
            minWidth: '0px',
            cRemarks: '',
            search: true },
          { label: '类型',
            prop: 'show_lx',
            minWidth: '0px',
            cRemarks: '',
            search: false },
          { label: '状态',
            prop: 'show_zt',
            minWidth: '0px',
            cRemarks: '',
            search: true },
          { label: '审核状态',
            prop: 'show_shzt',
            elTag: {
              filterType: function (value) {
                return value === '已审核' ? 'success' : 'danger';
              },
            },
            minWidth: '0px',
            cRemarks: '',
            search: true },
          { label: '主单位数量',
            prop: 'sl',
            minWidth: '0px',
            cRemarks: '',
            search: false },
          { label: '收货数量(主单位)',
            prop: 'shsl',
            minWidth: '0px',
            cRemarks: '',
            search: false },
          { label: '创建时间',
            prop: 'cjsj',
            minWidth: '0px',
            cRemarks: '',
            formatter: (row, column) => {
              return this.a.methods.formatterTime(row[column.property || column], 6);
            },
            type: 'DateRange',
            search: true },
          { label: '行号',
            prop: 'hh',
            minWidth: '0px',
            cRemarks: '',
            search: false },
          { label: '预计到货时间-起',
            prop: 'yjdhsjq',
            minWidth: '0px',
            cRemarks: '',
            search: false },
          { label: '金额',
            prop: 'je',
            minWidth: '0px',
            cRemarks: '',
            search: false },
          { label: '备注',
            prop: 'bz',
            minWidth: '0px',
            cRemarks: '',
            search: false },
          { label: '预计到货时间-止',
            prop: 'yjdhsjz',
            minWidth: '0px',
            cRemarks: '',
            search: false },
          { label: '主单位',
            prop: 'show_zdw',
            minWidth: '0px',
            cRemarks: '',
            search: false },
          { label: '供应商编号',
            prop: 'gysbh',
            minWidth: '0px',
            cRemarks: '',
            search: false },
          { label: '箱单位数量',
            prop: 'xdwsl',
            minWidth: '0px',
            cRemarks: '',
            search: false },
          { label: '体积',
            prop: 'tj',
            minWidth: '0px',
            cRemarks: '',
            search: false },
          { label: '联系人',
            prop: 'lxr',
            minWidth: '0px',
            cRemarks: '',
            search: false },
          { label: '净重',
            prop: 'jz',
            minWidth: '0px',
            cRemarks: '',
            search: false },
          { label: '详细地址',
            prop: 'xxdz',
            minWidth: '0px',
            cRemarks: '',
            search: false },
          { label: '毛重',
            prop: 'mz',
            minWidth: '0px',
            cRemarks: '',
            search: false },
          { label: '电话1',
            prop: 'dh1',
            minWidth: '0px',
            cRemarks: '',
            search: false },
          { label: '电话2',
            prop: 'dh2',
            minWidth: '0px',
            cRemarks: '',
            search: false },
          { label: '传真',
            prop: 'cz',
            minWidth: '0px',
            cRemarks: '',
            search: false },
          { label: '城市',
            prop: 'cs',
            minWidth: '0px',
            cRemarks: '',
            search: false },
          { label: '省',
            prop: 'sheng',
            minWidth: '0px',
            cRemarks: '',
            search: false },
          { label: '国家',
            prop: 'gj',
            minWidth: '0px',
            cRemarks: '',
            search: false },
          { label: '邮编',
            prop: 'yb',
            minWidth: '0px',
            cRemarks: '',
            search: false },
          { label: '仓库',
            prop: 'ssck',
            minWidth: '0px',
            cRemarks: '',
            search: false },
          { label: '计划到货时间',
            formatter: (row, column) => {
              return this.a.methods.formatterTime(row[column.property || column], 6);
            },
            prop: 'yjdhsj',
            minWidth: '0px',
            cRemarks: '',
            search: false },
          { label: '品项数',
            prop: 'pxs',
            minWidth: '0px',
            cRemarks: '',
            search: false },
          { label: '总数量',
            prop: 'zsl',
            minWidth: '0px',
            cRemarks: '',
            search: false },
          { label: '总毛重',
            prop: 'zzl',
            minWidth: '0px',
            cRemarks: '',
            search: false },
          { label: '总净重',
            prop: 'zjz',
            minWidth: '0px',
            cRemarks: '',
            search: false },
          { label: '总体积',
            prop: 'ztj',
            minWidth: '0px',
            cRemarks: '',
            search: false },
          { label: '备注',
            prop: ' bz',
            minWidth: '0px',
            cRemarks: '',
            search: false },
        ],
        url: '/wmsPurchaseOrder/list',
        key: 'id',
        tableColumn: 5,
      },
      dialog: {
        size: 'large',
        activeName: '1',
        formDialog2Bh: '',
        id: [],
        wmsPurchaseOrder: [],
        gys: __dialogGys(),
      },
      formDialog1: __form1(),
      formDialog2: __form2(),
      tableMx: __tableMx(),

      dialogMx: {
        title: '新增',
        size: 'large',
        row: {},
        hpid: [],
        pack: [],
        packValue: {
          bzlx: '0',
        },
        data: {},
        step: {},
        sum: 0,
      },
      formDialogMx: __formDialogMx(),

      dialogSearch: {
        size: 'large',
        row: {},
      },
      tableSearch: {
        ...__tableMx(),
        muti: false,
      },

      dialogEdit: {
        size: 'large',
        row: {},
      },
      formDialogEdit: __formEdit(),
    },
    transition: 'slide-fade',
    store: ['DICTIONARY_purchase', 'PURCHASE', 'USER'],
    methods: {
      tableDelete (row) {
        let tableRef = 'table';

        let ids = [];
        if (row) {
          ids.push(row.id);
        } else {
          if (this[tableRef].multipleSelection.length < 1) {
            return this.$alert('您还未选择，请您至少选择一个！', '提示');
          }
          this[tableRef].multipleSelection.forEach(item => {
            ids.push(item.id);
          });
        }
        this.$confirm('您将删除采购订单。', '确认删除？', {
          confirmButtonText: '是',
          cancelButtonText: '否',
          type: 'warning',
        })
          .then(async _ => {
            try {
              await this.post('/wmsPurchaseOrder/delete', {
                ids,
              });
              this.tableWatch('table');
            } catch (err) {
              console.log(err);
            }
          })
          .catch(_ => {
          });
      },
      tableExamine (row) {
        let tableRef = 'table';

        let ids = [];
        if (row) {
          ids.push(row.id);
        } else {
          if (this[tableRef].multipleSelection.length < 1) {
            return this.$alert('您还未选择，请您至少选择一个！', '提示');
          }
          this[tableRef].multipleSelection.forEach(item => {
            ids.push(item.id);
          });
        }
        this.$confirm('您将审核采购订单。', '确认审核？', {
          confirmButtonText: '是',
          cancelButtonText: '否',
          type: 'warning',
        })
          .then(async _ => {
            try {
              await this.post('/wmsPurchaseOrder/updateShzt', {
                ids,
              });
              this.tableWatch('table');
            } catch (err) {
              console.log(err);
            }
          })
          .catch(_ => {
          });
      },
      tableComplete (row) {
        let tableRef = 'table';

        let ids = [];
        if (row) {
          ids.push(row.id);
        } else {
          if (this[tableRef].multipleSelection.length < 1) {
            return this.$alert('您还未选择，请您至少选择一个！', '提示');
          }
          this[tableRef].multipleSelection.forEach(item => {
            ids.push(item.id);
          });
        }
        this.$confirm('您将标记采购订单。', '确认标记？', {
          confirmButtonText: '是',
          cancelButtonText: '否',
          type: 'warning',
        })
          .then(async _ => {
            try {
              await this.post('/wmsPurchaseOrder/updateZt', {
                ids,
              });
              this.tableWatch('table');
            } catch (err) {
              console.log(err);
            }
          })
          .catch(_ => {
          });
      },
      tableExport (row) {
        let tableRef = 'table';

        let ids = [];
        if (row) {
          ids.push(row.id);
        } else {
          this[tableRef].multipleSelection.forEach(item => {
            ids.push(item.id);
          });
        }
        this.$confirm('您将导出采购订单。', '确认导出？', {
          confirmButtonText: '是',
          cancelButtonText: '否',
          type: 'warning',
        })
          .then(async _ => {
            try {
              let option = Object.assign({}, this['autoVue_' + tableRef]);
              await this.p({
                url: '/wmsPurchaseOrder/getOutPutList',
                method: 'post',
                responseType: 'blob',
                data: {
                  ids,
                  ...option,
                },
              });
            } catch (err) {
              console.log(err);
            }
          })
          .catch(_ => {
          });
      },

      dialogInit () {
        this.dialog.activeName = '1';
        this.dialog.gys = __dialogGys();
        this.dialog.wmsPurchaseOrder = [];
        this.dialog.id = [];
        this.formDialog1 = {
          ...this.formDialog1,
          ...this.ObjectClone(__form1()),
        };
        this.formDialog2 = {
          ...this.formDialog2,
          ...this.ObjectClone(__form2()),
        };
        this.resetFields('formDialog1');
        this.resetFields('formDialog2');
        this.tableClear('tableMx');
      },
      async dialogOpen () {
        await AutoPromise([
          async () => {
            if (!this.DICTIONARY_goods) {
              await this.USE('DICTIONARY_purchase');
            }
          },
          // 查询 补丁
          async () => {
            this.dialog.id = await this.get('/wmsPurchaseOrder/getWmsOwnerSupplierByHzid');
          },
          async () => {
            this.dialog.wmsPurchaseOrder = await this.post('/wmsPurchaseOrder/getPoLx', {
              ddlx: '',
            });
          },
        ]);
        this.dialog.visible = true;
      },
      dialogPre () {
        this.dialog.activeName = parseInt(this.dialog.activeName) - 1 + '';
      },
      async dialogNext  () {
        if (this.dialog.activeName === '1') {
          if (this.dialog.gys.bh) {
            let {bh} = await this.post('/wmsPurchaseOrder/getBh/' + this.dialog.gys.bh);
            this.dialog.formDialog2Bh = bh;
          } else {
            return this.$alert('请选择一个供应商！', '提示');
          }
        }
        this.VALIDATE('formDialog' + this.dialog.activeName, option => {
          this.dialog.activeName = parseInt(this.dialog.activeName) + 1 + '';
        });
      },
      dialogSupplierGysid (id) {
        this.dialog.id.forEach(value => {
          if (value.id === id) {
            this.dialog.gys = this.ObjectClone(__dialogGys(), value, 'Object');
          }
        });
      },
      async dialogRemotePOlx (ddlx) {
        this.dialog.wmsPurchaseOrder = await this.post('/wmsPurchaseOrder/getPoLx', {
          ddlx,
        });
      },
      async dialogRemotePozt (id) {
        this.dialog.wmsPurchaseOrder.forEach(value => {
          if (value.id === id) {
            this.formDialog2.shzt = value.show_zdsh;
            this.formDialog2.zdsh = value.zdsh;
          }
        });
      },
      tableMxDelete (index) {
        this.$confirm('您将删除该条明细。', '确认删除？', {
          confirmButtonText: '是',
          cancelButtonText: '否',
          type: 'warning',
        })
          .then(() => {
            this.tableMx.data.splice(index, 1);
          });
      },
      dialogSave () {
        this.VALIDATE('formDialog2', async option => {
          if (this.tableMx.data.length < 1) {
            return this.$alert('新增 采购订单 中 明细不能为空！', '提示');
          }
          delete option.shzt;
          let json = {
            ...this.FORMOPTION('formDialog1'),
            ...option,
            wpodList: this.tableMx.data,
          };
          try {
            await this.post('/wmsPurchaseOrder/add', json);
            this.dialogInit();
            this.tableWatch('table');
            this.dialog.visible = false;
          } catch (err) {
            console.log(err);
          }
        });
      },

      dialogMxInit () {
        this.dialogMx.row = {};
        this.dialogMx.step = {};
        this.dialogMx.packValue = {
          bzlx: '0',
        };
        this.dialogMx.data = {};
        this.dialogMx.hpid = [];
        this.dialogMx.pack = [];
        this.formDialogMx = {
          ...this.formDialogMx,
          ...this.ObjectClone(__formDialogMx()),
        };
        this.resetFields('formDialogMx');
        this.dialogMx.title = '新增';
      },
      async dialogMxOpen (type, row) {
        if (type) {
          type = type.toUpperCase();
        } else return;
        await AutoPromise([
          async () => {
            this.dialogMxRemoteBh('');
          },
        ]);
        switch (type) {
        case 'ADD':
          this.dialogMx.title = '新增';
          break;
        case 'PUT':
          this.dialogMx.title = '修改';
          this.dialogMx.row = row;
          this.dialogMx.step = Object.assign({}, row);
          if (!this.$refs.formDialogMx) {
            setTimeout(() => {
              let unwatch = this.$watch('dialogMx.pack', () => {
                unwatch();
                if (this.dialogMx.pack.length > 1) {
                  let unwatch2 = this.$watch('formDialogMx.ms', () => {
                    unwatch2();
                    let unwatch3 = this.$watch('formDialogMx.sum', () => {
                      unwatch3();
                      this.formDialogMx.sum = this.dialogMx.step.je || 0;
                    });
                    this.formDialogMx.sl = this.dialogMx.step.sl || 0;
                    this.formDialogMx.xdwsl = this.dialogMx.step.xdwsl || '';
                  });
                  this.formDialogMx.ms = this.dialogMx.step.ms;
                }
              });
              this.formDialogMx = {
                ...this.formDialogMx,
                ...this.ObjectClone(__formDialogMx(), row),
              };
            }, 250);
          } else {
            let unwatch = this.$watch('dialogMx.pack', () => {
              unwatch();
              if (this.dialogMx.pack.length > 1) {
                let unwatch2 = this.$watch('formDialogMx.ms', () => {
                  unwatch2();
                  let unwatch3 = this.$watch('formDialogMx.sum', () => {
                    unwatch3();
                    this.formDialogMx.sum = this.dialogMx.step.je || 0;
                  });
                  this.formDialogMx.sl = this.dialogMx.step.sl || 0;
                  this.formDialogMx.xdwsl = this.dialogMx.step.xdwsl || '';
                });
                this.formDialogMx.ms = this.dialogMx.step.ms;
              }
            });
            this.formDialogMx = {
              ...this.formDialogMx,
              ...this.ObjectClone(__formDialogMx(), row),
            };
          }
          break;
        }
        this.dialogMx.visible = true;
      },
      dialogMxChangeBh (goodsBh) {
        this.formDialogMx.sl = '';
        this.formDialogMx.xdwsl = '';
        this.dialogMx.hpid.forEach(value => {
          if (value.goodsBh === goodsBh) {
            this.dialogMx.data = value;
            this.formDialogMx.mc = value.goodsName;
            this.formDialogMx.bzmc = value.bzmc;
            this.formDialogMx.ms = '';
            this.dialogMx.packValue = {
              bzlx: '0',
            };
            this.dialogMxRemotePack(value.packId);
          }
        });
      },
      async dialogMxRemoteBh (Bh) {
        this.dialogMx.hpid = await this.post('/wmsPurchaseOrder/getGoods', {
          bh: Bh,
          gysid: this.dialogSearch.row.gysid || this.formDialog1.gysid,
        });
      },
      dialogMxChangeMs (ms) {
        this.formDialogMx.sl = '';
        this.formDialogMx.xdwsl = '';
        this.dialogMx.pack.forEach(value => {
          if (value.ms === ms) {
            this.dialogMx.packValue = value;
            this.formDialogMx = {
              ...this.formDialogMx,
              ...this.ObjectClone(__formDialogMx_pack(), value),
            };
          }
        });
      },
      async dialogMxRemotePack (packId) {
        this.dialogMx.pack = await this.get('/wmsPurchaseOrder/packDetailList/' + packId);
      },
      dialogMxSave () {
        this.VALIDATE('formDialogMx', async option => {
          let table = 'tableMx';
          if (this.dialogSearch.row.id) {
            table = 'tableSearch';
          }
          if (table === 'tableMx') {
            let check = true;
            this[table].data.forEach((value, index) => {
              if (this.dialogMx.row.bh === value.bh) {
                this[table].data.splice(index, 1);
              } else if (this.dialogMx.data.goodsBh === value.bh) {
                this.$alert(`发现货品 ${value.bh} 已经存在！`, '提示');
                check = false;
              }
            });
            if (check) {
              this[table].data.push({
                ...option,
                hpid: this.dialogMx.data.goodsId,
                zdw: this.dialogMx.packValue.id,
                je: this.formDialogMx.sum,
              });
              this[table].total++;
              this.dialogMxInit();
              this.dialogMx.visible = false;
            }
          } else {
            try {
              if (this.dialogMx.title === '新增') {
                await this.post('/wmsPurchaseOrderDetailed/add', {
                  ...option,
                  hpid: this.dialogMx.data.goodsId,
                  zdw: this.dialogMx.packValue.id,
                  sscgdid: this.dialogSearch.row.id,
                  je: this.formDialogMx.sum,
                });
              } else {
                await this.post('/wmsPurchaseOrderDetailed/edit', {
                  ...option,
                  hpid: this.dialogMx.data.goodsId,
                  zdw: this.dialogMx.packValue.id,
                  sscgdid: this.dialogSearch.row.id,
                  id: this.dialogMx.row.id,
                  je: this.formDialogMx.sum,
                });
              }
              this.tableSearch.data = await this.get('/wmsPurchaseOrder/wmsPurchaseOrderDetailList/' + this.dialogSearch.row.id);
              this.dialogMxInit();
              this.dialogMx.visible = false;
            } catch (err) {
              console.error(err);
            }
          }
        });
      },

      dialogSearchInit () {
        this.dialogSearch.row = {};
      },
      async dialogSearchOpen (row) {
        this.dialogSearch.row = row;
        this.tableSearch.data = await this.get('/wmsPurchaseOrder/wmsPurchaseOrderDetailList/' + row.id);
        this.dialogSearch.visible = true;
      },
      tableSearchDelete (row) {
        let id = this.dialogSearch.row.id;
        let tableRef = 'tableSearch';
        let deleteUrl = '/wmsPurchaseOrderDetailed/delete';
        let tips = '采购订单明细';

        let ids = [];
        if (row) {
          ids.push(row.id);
        } else {
          if (this[tableRef].multipleSelection.length < 1) {
            return this.$alert('您还未选择，请您至少选择一个！', '提示');
          }
          this[tableRef].multipleSelection.forEach(item => {
            ids.push(item.id);
          });
        }
        this.$confirm('您将删除' + tips + '。', '确认删除？', {
          confirmButtonText: '是',
          cancelButtonText: '否',
          type: 'warning',
        })
          .then(async _ => {
            try {
              await this.post(deleteUrl, {
                id,
                ids,
              });
              // this.tableWatch(tableRef);
              this.tableSearch.data = await this.get('/wmsPurchaseOrder/wmsPurchaseOrderDetailList/' + this.dialogSearch.row.id);
            } catch (err) {
              console.log(err);
            }
          })
          .catch(_ => {
          });
      },
      dialogSearchSave () {
        this.dialogSearchInit();
        this.dialogSearch.visible = false;
      },

      dialogEditInit () {
        this.dialogEdit.row = {};
        this.dialog.id = [];
        this.dialog.gys = __dialogGys();
        this.formDialogEdit = {
          ...this.formDialogEdit,
          ...this.ObjectClone(__formEdit()),
        };
        this.resetFields('formDialogEdit');
      },
      async dialogEditOpen (row) {
        await AutoPromise([
          async () => {
            if (!this.DICTIONARY_goods) {
              await this.USE('DICTIONARY_purchase');
            }
          },
          async () => {
            this.dialog.id = await this.get('/wmsPurchaseOrder/getWmsOwnerSupplierByHzid');
          },
          async () => {
            await this.dialogRemotePOlx('');
          },
        ]);
        this.dialogEdit.row = row;
        this.formDialogEdit = {
          ...this.formDialogEdit,
          ...this.ObjectClone(__formEdit(), row),
          shzt: '',
        };
        this.dialogSupplierGysid(this.formDialogEdit.gysid);
        this.dialogEdit.visible = true;
      },
      dialogEditSave () {
        this.VALIDATE('formDialogEdit', async option => {
          option.id = this.dialogEdit.row.id;
          try {
            await this.post('/wmsPurchaseOrder/edit', option);
            this.dialogEditInit();
            this.tableWatch('table');
            this.dialogEdit.visible = false;
          } catch (err) {
            console.log(err);
          }
        });
      },
    },
    computed: {
      formDialogMxje: function () {
        if (this.formDialogMx.sl) {
          return this.formDialogMx.je * this.formDialogMx.sl;
        } else {
          return this.formDialogMx.je;
        }
      },
      formDialogMxzl: function () {
        if (this.formDialogMx.sl) {
          return this.formDialogMx.zl * this.formDialogMx.sl;
        } else {
          return this.formDialogMx.zl;
        }
      },
      formDialogMxjz: function () {
        if (this.formDialogMx.sl) {
          return this.formDialogMx.jz * this.formDialogMx.sl;
        } else {
          return this.formDialogMx.jz;
        }
      },
      formDialogMxtj: function () {
        if (this.formDialogMx.sl) {
          return this.formDialogMx.tj * this.formDialogMx.sl;
        } else {
          return this.formDialogMx.tj;
        }
      },
    },
    watch: {
      'formDialogMx.sl': function (item) {
        let sum = parseInt(this.formDialogMxje);
        this.formDialogMx.sum = isNaN(sum) ? 0 : sum;
        if (item && this.dialogMx.packValue.bzlx === '0' && this.dialogMx.packValue.zdwsl) {
          let zdwsl = parseInt(this.dialogMx.packValue.zdwsl);
          let source = parseInt(item);
          this.formDialogMx.xdwsl = `${Math.floor(source / zdwsl)}箱${source % zdwsl}件`;
        }
      },
      'formDialogMx.xdwsl': function (item) {
        if (item && this.dialogMx.packValue.bzlx !== '0' && this.dialogMx.packValue.zdwsl) {
          let reg = /(\d{1,5})箱(\d{1,5})件/;
          if (reg.test(item)) {
            let zdwsl = parseInt(this.dialogMx.packValue.zdwsl);
            let source = reg.exec(item);
            let xiang = parseInt(source[1]);
            let jian = parseInt(source[2]);
            this.formDialogMx.sl = xiang * zdwsl + jian + '';
          }
        }
      },
      'dialog.formDialog2Bh': function (bh) {
        this.formDialog2.bh = bh;
      },
    },
    mounted: async function () {
      this.tableWatch('table');
      if (!this.DICTIONARY_goods) {
        await this.USE('DICTIONARY_purchase');
      }
    },
  });
</script>
<style scoped lang="scss">
  .box-card {
    margin: 20px;
  }

  .createTimeSpan {
    display: block;
    margin-top: 34px;
  }

  @media screen and (max-width: 800px) {
    .createTimeSpan {
      margin-top: 0;
    }
    .box-card {
      margin: 0;
    }
  }

  .el-select {
    width: 100%;
  }
</style>

<style lang="scss">

</style>
